From edc6ebc5c16f806cd29655103b6d2e24f58fedd1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 6 Nov 2014 22:38:26 -0800 Subject: [PATCH] Update with breaking changes from tonight's nigthly --- Cargo.lock | 14 +++++++------- Cargo.toml | 1 + src/cargo/core/registry.rs | 6 +++--- src/cargo/core/resolver/encode.rs | 4 ++-- src/cargo/core/resolver/mod.rs | 4 ++-- src/cargo/core/source.rs | 4 ++-- src/cargo/ops/cargo_compile.rs | 2 +- src/cargo/ops/cargo_rustc/context.rs | 2 +- src/cargo/ops/cargo_rustc/links.rs | 2 +- src/cargo/ops/lockfile.rs | 10 +++++----- src/cargo/sources/registry.rs | 4 ++-- src/cargo/util/config.rs | 2 +- src/cargo/util/dependency_queue.rs | 6 +++--- src/cargo/util/graph.rs | 2 +- 14 files changed, 32 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb96674e4..2ebe653e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ dependencies = [ "curl 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle)", "docopt 0.6.8 (git+https://github.com/docopt/docopt.rs)", "flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs)", - "git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)", + "git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs?ref=no-build-cmd)", "glob 0.0.1 (git+https://github.com/rust-lang/glob)", "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)", "registry 0.0.1-pre", @@ -34,7 +34,7 @@ source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#b595431adb3ff [[package]] name = "docopt" version = "0.6.8" -source = "git+https://github.com/docopt/docopt.rs#1b614c83b771b23e95e69d10b4bc04c87ff7eff3" +source = "git+https://github.com/docopt/docopt.rs#0b184b15ed5ea7e3c180b088e8f99baa4427f989" [[package]] name = "encoding" @@ -81,9 +81,9 @@ source = "git+https://github.com/alexcrichton/flate2-rs#31d9253355ba837cd62487b8 [[package]] name = "git2" version = "0.0.1" -source = "git+https://github.com/alexcrichton/git2-rs#556e27113a4918cede9b80e447a5ebad524f3357" +source = "git+https://github.com/alexcrichton/git2-rs?ref=no-build-cmd#b7a84b817bc62df62e4449b7d78aa3887bd3b4c7" dependencies = [ - "libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)", + "libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs?ref=no-build-cmd)", "url 0.1.0 (git+https://github.com/servo/rust-url)", ] @@ -100,7 +100,7 @@ source = "git+https://github.com/carllerche/hamcrest-rust.git#998036d000095f72c8 [[package]] name = "libgit2" version = "0.0.1" -source = "git+https://github.com/alexcrichton/git2-rs#556e27113a4918cede9b80e447a5ebad524f3357" +source = "git+https://github.com/alexcrichton/git2-rs?ref=no-build-cmd#b7a84b817bc62df62e4449b7d78aa3887bd3b4c7" dependencies = [ "libssh2-static-sys 0.0.1 (git+https://github.com/alexcrichton/libssh2-static-sys)", "link-config 0.0.1 (git+https://github.com/alexcrichton/link-config)", @@ -142,12 +142,12 @@ source = "git+https://github.com/alexcrichton/tar-rs#47d2cc4b09e373a4cc7bee7c71e [[package]] name = "toml" version = "0.1.0" -source = "git+https://github.com/alexcrichton/toml-rs#78acb5081d57bec85fd51ecb596506b14d17d430" +source = "git+https://github.com/alexcrichton/toml-rs#ac6f3b27e03e7a5938fd4cae5fc3fecc5ab1a85f" [[package]] name = "url" version = "0.1.0" -source = "git+https://github.com/servo/rust-url#9142b86a812ac5bc886f76235585557d8e002246" +source = "git+https://github.com/servo/rust-url#cec3c32168ce4233e179f22ef50215b3a9c34342" dependencies = [ "encoding 0.2.0 (git+https://github.com/lifthrasiir/rust-encoding)", ] diff --git a/Cargo.toml b/Cargo.toml index a15610142..cb1bddbe0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ git = "https://github.com/alexcrichton/flate2-rs" [dependencies.git2] git = "https://github.com/alexcrichton/git2-rs" +branch = "no-build-cmd" [dependencies.glob] git = "https://github.com/rust-lang/glob" diff --git a/src/cargo/core/registry.rs b/src/cargo/core/registry.rs index 26e613dae..eb4d45f20 100644 --- a/src/cargo/core/registry.rs +++ b/src/cargo/core/registry.rs @@ -109,7 +109,7 @@ impl<'a> PackageRegistry<'a> { } fn ensure_loaded(&mut self, namespace: &SourceId) -> CargoResult<()> { - match self.source_ids.find(namespace) { + match self.source_ids.get(namespace) { // We've previously loaded this source, and we've already locked it, // so we're not allowed to change it even if `namespace` has a // slightly different precise version listed. @@ -213,7 +213,7 @@ impl<'a> PackageRegistry<'a> { // to be rewritten to a locked version wherever possible. If we're unable to // map a dependency though, we just pass it on through. fn lock(&self, summary: Summary) -> Summary { - let pair = self.locked.find(summary.get_source_id()).and_then(|map| { + let pair = self.locked.get(summary.get_source_id()).and_then(|map| { map.find_equiv(summary.get_name()) }).and_then(|vec| { vec.iter().find(|&&(ref id, _)| id == summary.get_package_id()) @@ -242,7 +242,7 @@ impl<'a> PackageRegistry<'a> { // dependency. If anything does then we lock it to that and move // on. None => { - let v = self.locked.find(dep.get_source_id()).and_then(|map| { + let v = self.locked.get(dep.get_source_id()).and_then(|map| { map.find_equiv(dep.get_name()) }).and_then(|vec| { vec.iter().find(|&&(ref id, _)| dep.matches_id(id)) diff --git a/src/cargo/core/resolver/encode.rs b/src/cargo/core/resolver/encode.rs index 152be313d..203f3c7dd 100644 --- a/src/cargo/core/resolver/encode.rs +++ b/src/cargo/core/resolver/encode.rs @@ -30,7 +30,7 @@ impl EncodableResolve { let pkgid = try!(pkg.to_package_id(default)); let precise = pkgid.get_source_id().get_precise() .map(|s| s.to_string()); - assert!(tmp.insert(pkgid.clone(), precise), + assert!(tmp.insert(pkgid.clone(), precise).is_none(), "a package was referenced twice in the lockfile"); g.add(try!(pkg.to_package_id(default)), []); Ok(()) @@ -53,7 +53,7 @@ impl EncodableResolve { for edge in deps.iter() { let to_depend_on = try!(edge.to_package_id(default)); let precise_pkgid = - tmp.find(&to_depend_on) + tmp.get(&to_depend_on) .map(|p| to_depend_on.with_precise(p.clone())) .unwrap_or(to_depend_on.clone()); g.link(package_id.clone(), precise_pkgid); diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index 326c32447..0f025a48d 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -110,7 +110,7 @@ impl Resolve { } pub fn features(&self, pkg: &PackageId) -> Option<&HashSet> { - self.features.find(pkg) + self.features.get(pkg) } } @@ -199,7 +199,7 @@ fn activate_deps<'a, R: Registry>(cx: Context, dep.uses_default_features(), platform); let key = (dep.get_name().to_string(), dep.get_source_id().clone()); - let prev_active = cx.activations.find(&key) + let prev_active = cx.activations.get(&key) .map(|v| v.as_slice()).unwrap_or(&[]); log!(5, "{}[{}]>{} {} candidates", parent.get_name(), cur, dep.get_name(), candidates.len()); diff --git a/src/cargo/core/source.rs b/src/cargo/core/source.rs index e79555de1..eb4030165 100644 --- a/src/cargo/core/source.rs +++ b/src/cargo/core/source.rs @@ -339,7 +339,7 @@ impl<'src> SourceMap<'src> { } pub fn get(&self, id: &SourceId) -> Option<&Source+'src> { - let source = self.map.find(id); + let source = self.map.get(id); source.map(|s| { let s: &Source+'src = &**s; @@ -348,7 +348,7 @@ impl<'src> SourceMap<'src> { } pub fn get_mut(&mut self, id: &SourceId) -> Option<&mut Source+'src> { - self.map.find_mut(id).map(|s| { + self.map.get_mut(id).map(|s| { let s: &mut Source+'src = &mut **s; s }) diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 6f47fe380..d05685770 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -183,7 +183,7 @@ fn scrape_target_config(config: &Config, })), }; let triple = config.target().unwrap_or(config.rustc_host()).to_string(); - let target = match target.find(&triple) { + let target = match target.get(&triple) { None => return Ok(HashMap::new()), Some(target) => try!(target.table().chain_error(|| { internal(format!("invalid configuration for the key \ diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index b2bd59eb2..5e9207aa9 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -165,7 +165,7 @@ impl<'a, 'b: 'a> Context<'a, 'b> { pub fn get_requirement(&self, pkg: &'a Package, target: &'a Target) -> PlatformRequirement { - self.requirements.find(&(pkg.get_package_id(), target.get_name())) + self.requirements.get(&(pkg.get_package_id(), target.get_name())) .map(|a| *a).unwrap_or(PlatformTarget) } diff --git a/src/cargo/ops/cargo_rustc/links.rs b/src/cargo/ops/cargo_rustc/links.rs index 58b99153c..5624528f1 100644 --- a/src/cargo/ops/cargo_rustc/links.rs +++ b/src/cargo/ops/cargo_rustc/links.rs @@ -13,7 +13,7 @@ pub fn validate(deps: &PackageSet) -> CargoResult<()> { Some(lib) => lib, None => continue, }; - match map.find(&lib) { + match map.get(&lib) { Some(previous) => { return Err(human(format!("native library `{}` is being linked \ to by more than one package, and \ diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index 441c11d46..25ff599cf 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -42,12 +42,12 @@ pub fn write_lockfile(dst: &Path, resolve: &Resolve) -> CargoResult<()> { // Note that we do not use e.toml.to_string() as we want to control the // exact format the toml is in to ensure pretty diffs between updates to the // lockfile. - let root = e.toml.find(&"root".to_string()).unwrap(); + let root = e.toml.get(&"root".to_string()).unwrap(); out.push_str("[root]\n"); emit_package(root.as_table().unwrap(), &mut out); - let deps = e.toml.find(&"package".to_string()).unwrap().as_slice().unwrap(); + let deps = e.toml.get(&"package".to_string()).unwrap().as_slice().unwrap(); for dep in deps.iter() { let dep = dep.as_table().unwrap(); @@ -55,7 +55,7 @@ pub fn write_lockfile(dst: &Path, resolve: &Resolve) -> CargoResult<()> { emit_package(dep, &mut out); } - match e.toml.find(&"metadata".to_string()) { + match e.toml.get(&"metadata".to_string()) { Some(metadata) => { out.push_str("[metadata]\n"); out.push_str(metadata.to_string().as_slice()); @@ -75,7 +75,7 @@ fn emit_package(dep: &toml::TomlTable, out: &mut String) { out.push_str(format!("source = {}\n", lookup(dep, "source")).as_slice()); } - if let Some(ref s) = dep.find(&"dependencies".to_string()) { + if let Some(ref s) = dep.get(&"dependencies".to_string()) { let slice = s.as_slice().unwrap(); if !slice.is_empty() { @@ -92,5 +92,5 @@ fn emit_package(dep: &toml::TomlTable, out: &mut String) { } fn lookup<'a>(table: &'a toml::TomlTable, key: &str) -> &'a toml::Value { - table.find(&key.to_string()).expect(format!("Didn't find {}", key).as_slice()) + table.get(&key.to_string()).expect(format!("Didn't find {}", key).as_slice()) } diff --git a/src/cargo/sources/registry.rs b/src/cargo/sources/registry.rs index e762d9feb..008ca63c3 100644 --- a/src/cargo/sources/registry.rs +++ b/src/cargo/sources/registry.rs @@ -317,8 +317,8 @@ impl<'a, 'b> RegistrySource<'a, 'b> { } // Verify what we just downloaded - let expected = self.hashes.find(&(pkg.get_name().to_string(), - pkg.get_version().to_string())); + let expected = self.hashes.get(&(pkg.get_name().to_string(), + pkg.get_version().to_string())); let expected = try!(expected.require(|| { internal(format!("no hash listed for {}", pkg)) })); diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index 941bf5d74..398cd0898 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -324,7 +324,7 @@ fn walk_tree(pwd: &Path, fn extract_config(mut file: File, key: &str) -> CargoResult { let contents = try!(file.read_to_string()); let mut toml = try!(cargo_toml::parse(contents.as_slice(), file.path())); - let val = try!(toml.pop(&key.to_string()).require(|| internal(""))); + let val = try!(toml.remove(&key.to_string()).require(|| internal(""))); ConfigValue::from_toml(file.path(), val) } diff --git a/src/cargo/util/dependency_queue.rs b/src/cargo/util/dependency_queue.rs index 3b4028ea6..9ffadafc0 100644 --- a/src/cargo/util/dependency_queue.rs +++ b/src/cargo/util/dependency_queue.rs @@ -86,7 +86,7 @@ impl, V> DependencyQueue { }; assert!(rev.insert(key.clone())); } - assert!(self.dep_map.insert(key, (my_dependencies, value))); + assert!(self.dep_map.insert(key, (my_dependencies, value)).is_none()); } /// Dequeues a package that is ready to be built. @@ -100,7 +100,7 @@ impl, V> DependencyQueue { Some(key) => key, None => return None }; - let (_, data) = self.dep_map.pop(&key).unwrap(); + let (_, data) = self.dep_map.remove(&key).unwrap(); let fresh = if self.dirty.contains(&key) {Dirty} else {Fresh}; self.pending.insert(key.clone()); Some((fresh, key, data)) @@ -117,7 +117,7 @@ impl, V> DependencyQueue { /// possibly allowing the next invocation of `dequeue` to return a package. pub fn finish(&mut self, key: &K, fresh: Freshness) { assert!(self.pending.remove(key)); - let reverse_deps = match self.reverse_dep_map.find(key) { + let reverse_deps = match self.reverse_dep_map.get(key) { Some(deps) => deps, None => return, }; diff --git a/src/cargo/util/graph.rs b/src/cargo/util/graph.rs index 3ed6cc584..119ab092d 100644 --- a/src/cargo/util/graph.rs +++ b/src/cargo/util/graph.rs @@ -37,7 +37,7 @@ impl Graph { } pub fn edges(&self, node: &N) -> Option> { - self.nodes.find(node).map(|set| set.iter()) + self.nodes.get(node).map(|set| set.iter()) } pub fn sort(&self) -> Option> { -- 2.30.2